﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.BlackApart.Business.Prices {
    public class DayOfWeekPriceModifier : ApartmentPriceModifier {

        #region Fieds

        private DayOfWeek dayOfWeek;
        private double modifiedPrice;

        #endregion

        #region Methods

        public override void Prepare() {
            this.dayOfWeek = (DayOfWeek) this.ModificationFixedVariable;
            this.modifiedPrice = this.GetModifiedPrice(this.ModificationType, this.ModificationChangeValue, this.InitialPrice);
        }

        public override double GetPriceForDay(DateTime priceForDay) {
            if (priceForDay.DayOfWeek == this.dayOfWeek)
                return this.modifiedPrice;
            else return this.InitialPrice;
        }

        public override double GetPriceDiffForDay(DateTime priceForDay) {
            if (priceForDay.DayOfWeek == this.dayOfWeek)
                return this.modifiedPrice - this.InitialPrice;
            else return 0;
        }

        public override bool ModifierIsApplicable(DateTime priceForDay) {
            return priceForDay.DayOfWeek == this.dayOfWeek;
        }

        #endregion

    }
}
